package com.leslie.wukong.biz.product.client;

import com.leslie.wukong.biz.product.domain.vo.ProductVO;
import com.leslie.wukong.biz.product.handler.AbstractCheckHandler;
import com.leslie.wukong.common.core.domain.RestResult;
import lombok.extern.slf4j.Slf4j;

/**
 * ClassName: HandlerClient
 * Package: com.leslie.wukong.biz.product.client
 * Description:
 * @date: 2024/12/3 18:48
 * @author: itcoder
 */
@Slf4j
public class HandlerClient {
    public static RestResult<Integer> executeChain(AbstractCheckHandler handler, ProductVO param) {
        RestResult<Integer> handlerResult = handler.handle(param);
        if (!handlerResult.isSuccess()) {
            log.info("HandlerClient 责任链执行失败返回: " + handlerResult.toString());
            return handlerResult;
        }
        return RestResult.ok();
    }
}
